
public function <?= $this->function_name ?>($dbh<? if ($this->group_update): ?>,$deleteValues<? else: ?><?
    foreach ($this->variables as $name => $setting) {
        if (!empty($setting['func_param'])) {
            echo ', $' . $name;
        }
    }
    ?><? endif; ?>){
<?= $this->custom_header_code; ?>

$runQuery="DELETE FROM  ";


<?
foreach ($this->frome_tables as $one) {
    echo '$runQuery.="';

    echo '{' . $one['table_variable'] . '}';

    if (!empty($one['table_alias'])) {
        echo " as {$one['table_alias']}";
    }



    echo "\";\n";

    //update only support ont table;
    break;
}
?>


<?
if (!empty($this->where_claus)) {
    echo '$runQuery.=" ' . 'WHERE " ';
    foreach ($this->where_claus as $one) {
        echo "." . $one;
    }
    echo ";\n";
}
?>







try {

$stmt = $dbh->prepare($runQuery);
<? if ($this->around_transaction): ?>
    $dbh->beginTransaction();
    $errorFlag = false;

<? endif; ?>

<? if ($this->group_update): ?>

    $totalCount=0;

    foreach ($deleteValues as $one) {
    <? $this->generatPdoBinds('$stmt', true); ?>
    <? $this->generatPdoFixStrBinds('$stmt'); ?>
    $stmt_r = $stmt->execute();
    if ($stmt_r) {
    $totalCount+= $stmt->rowCount();

    } else {

    error_log('db error info:' . var_export($stmt->errorInfo(), true) . " query:" . $runQuery);
    <? if ($this->around_transaction): ?>
        $errorFlag = true;

        break;

    <? endif; ?>
    }



    }
    <? if ($this->around_transaction): ?>
        if ($errorFlag) {
        $dbh->rollBack();
        $totalCount=0;
        } else {
        $dbh->commit();
        }



    <? endif; ?>


    return $totalCount;


<? else: ?>
    <? $this->generatPdoBinds('$stmt'); ?>
    <? $this->generatPdoFixStrBinds('$stmt'); ?>

    $stmt_r = $stmt->execute();
    if($stmt_r){
    return $stmt->rowCount();
    }
    else {

    <? if (!empty($this->error_log)): ?>
        <?= $this->error_log ?>('db error info:' . var_export($stmt->errorInfo(), true)." query:".$runQuery);
    <? else: ?>
        //$errorMessage='db error info:' . var_export($stmt->errorInfo(), true)." query:".$runQuery;
    <? endif ?>
    return false;
    }

<? endif; ?>
}
catch ( PDOException $x ) {
<? if (!empty($this->error_log)): ?>
    <?= $this->error_log ?>('db error info:' . $x->getMessage()." query:".$runQuery);
<? else: ?>
    //$errorMessage='db error info:' . $x->getMessage()." query:".$runQuery;
<? endif ?>
<? if ($this->around_transaction): ?>
    $dbh->rollBack();

<? endif; ?>
throw $x;
}
<?= $this->custom_tailer_code; ?>

}
